var RingBufferOutputModifier = OutputModifier.extend({
	size: null,

	start: 0,
	end: 0,
	buffer: [],
	constructor: function(ime,size)
	{
		this.base(ime);
		if(size) this.size = size+1;
		this.start = 0;
		this.end = 0;
	},
	ModifierName: function()
	{
		return 'RingBufferModifier';
	},
	GetBuffer: function()
	{
		var str;
		var i;

		str = '';
		i = this.start;
		while(i != this.end) {
			str += this.buffer[i++];
			if(i >= this.size) i = 0;
		}
		return str;
	},
	Modify: function(str)
	{
		this.buffer[this.end++] = str;
		if(this.end >= this.size) this.end = 0;
		if(this.end == this.start) this.start++;
		if(this.start >= this.size) this.start = 0;
		return str;
	}
});
